const fs = require('fs')
const path = require('path')
//读取流
// const readStream = fs.createReadStream('./a.txt',{
//     highWaterMark:1024
// })
// readStream.on("open",()=>{
//     console.log('打开小说')
// })
// readStream.on("ready",()=>{
//     console.log('小说已准备好')
// })
// readStream.on("data",()=>{
//     if(readStream.bytesRead === 2048){
//         console.log('开始读取小说,数据',readStream.bytesRead)
//         readStream.pause()
//     }
//     console.log('开始读取小说,数据',readStream.bytesRead)
// })
// readStream.on("close",()=>{
//     console.log('关闭小说')
// })
// setTimeout(()=>{
//     readStream.resume()
// },2000)
//写入流
// const writeStream = fs.createWriteStream('./b.txt')
// writeStream.on('open',_=>{
//     console.log('文件已打开')
// })
// writeStream.on('ready',_=>{
//     console.log('文件读取成功,开始写入小说')
//     writeStream.write(fs.readFileSync(path.join(process.cwd(),'a.txt'),'utf-8'))

// })
// writeStream.on('close',_=>{
//     console.log('文件已关闭')
// })
// process.stdout.write("请输入:")
// process.stdin.on("data",chunk =>{
//     console.log(chunk.toString())
// })
